package io.jee.caisan.weixin.domain;

import java.util.Set;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.DynamicUpdate;

@Entity
@DynamicUpdate
public class SysMember {

	private Integer mid;
	private String username;
	private String password;
	private Set<String> authorities;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getMid() {
		return mid;
	}

	public void setMid(Integer mid) {
		this.mid = mid;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@ElementCollection(fetch=FetchType.EAGER)
	@CollectionTable(name="sys_member_authority", uniqueConstraints={@UniqueConstraint(columnNames={"sys_member_mid","authority"})})
	@Column(name="authority")
	public Set<String> getAuthorities() {
		return authorities;
	}

	public void setAuthorities(Set<String> authorities) {
		this.authorities = authorities;
	}

}
